import { readSimpleConfigFileAllLines } from "../electron/main/util/file-utils";
import { LocalProjectItem } from "../common/local-project.types";
import { mergeSingleNode, scanProjects } from "../electron/main/modules/local-project/local-project.service";

interface ProjectItem extends LocalProjectItem {}

(async () => {
  const values = await readSimpleConfigFileAllLines("../config/local-project.exclude.txt");
  const excludes = values.reduce((acc, it) => ((acc[it] = 1), acc), {} as Record<string, number>);

  const folder: ProjectItem = { key: "D:\\Workspace", title: "D:\\Workspace", path: "D:\\Workspace" };
  await scanProjects(folder, excludes);
  // deleteEmptyProject(folder)
  mergeSingleNode(folder)
  console.log(folder.children);
})();
